home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Turnbull China Bikeride
/
Turnbull China Bikeride - Disc 2.iso
/
BARNET
/
ARMLINUX
/
MAIL
/
9804
/
000089_pb@nexus.co.uk _Mon Apr 20 12:26:58 1998.msg
< prev
next >
Wrap
Internet Message Format
|
1998-05-13
|
2KB
Return-Path: <pb@nexus.co.uk>
Received: from globe (nexusel.demon.co.uk [158.152.30.195])
by odie.barnet.ac.uk (8.8.6/8.8.6) with SMTP id MAA15613
for <willy@odie.barnet.ac.uk>; Mon, 20 Apr 1998 12:26:56 +0100
Received: from (spring.nexus.co.uk) [192.0.0.3] (root)
by globe with smtp (Exim 1.82 #1)
id 0yREcS-00004h-00; Mon, 20 Apr 1998 12:20:16 +0100
Received: from localhost (spring.nexus.co.uk) [127.0.0.1] (pb)
by spring.nexus.co.uk with esmtp (Exim 1.82 #1)
id 0yREXv-00009W-00; Mon, 20 Apr 1998 12:15:35 +0100
X-Mailer: exmh version 2.0zeta 7/24/97
To: Matthew Wilcox <willy@odie.barnet.ac.uk>
cc: linux-arm@vger.rutgers.edu, mdw@ebi.ac.uk
Subject: Re: strchr.S
In-reply-to: Your message of "Mon, 20 Apr 1998 11:52:59 BST."
<199804201053.LAA15415@odie.barnet.ac.uk>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Date: Mon, 20 Apr 1998 12:15:34 +0100
From: Philip Blundell <pb@nexus.co.uk>
Message-Id: <E0yREXv-00009W-00@spring.nexus.co.uk>
Status: RO
>Here's a 39-instruction of strchr which works word-at-a-time. I have
>neither tested nor benchmarked it. Phil, does glibc have a testsuite
>for strchr? If not, I ought to write one - there are so many cases to
>take care of.
Yes, we do have one. Here's the code. If you can think of additional tests
to add then please do.
void
test_strchr (void)
{
it = "strchr";
check (strchr ("abcd", 'z') == NULL, 1); /* Not found. */
(void) strcpy (one, "abcd");
check (strchr (one, 'c') == one+2, 2); /* Basic test. */
check (strchr (one, 'd') == one+3, 3); /* End of string. */
check (strchr (one, 'a') == one, 4); /* Beginning. */
check (strchr (one, '\0') == one+4, 5); /* Finding NUL. */
(void) strcpy (one, "ababa");
check (strchr (one, 'b') == one+1, 6); /* Finding first. */
(void) strcpy (one, "");
check (strchr (one, 'b') == NULL, 7); /* Empty string. */
check (strchr (one, '\0') == one, 8); /* NUL in empty string. */
{
char buf[4096];
int i;
char *p;
for (i=0; i < 0x100; i++)
{
p = (char *) ((unsigned long int) (buf + 0xff) & ~0xff) + i;
strcpy (p, "OK");
strcpy (p+3, "BAD/WRONG");
check (strchr (p, '/') == NULL, 9+i);
}
}
}
p.